<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><!--%nom_fonction%--></title>
			<link rel="stylesheet" type="text/css" href="../../css/main.css" />
            <link rel="stylesheet" type="text/css" href="<!--%css_module%-->" />
			<!--[if IE 7]>
            	<link rel="stylesheet" type="text/css" href="../../css/ie7.css" />
            	<link rel="stylesheet" type="text/css" href="form_ie7.css" />
            <![endif]-->
			<script language="Javascript"type="text/JavaScript">
// Requette AJAX
function makeRequest(url,id_niveau,id_ecrire){
var http_request = false;
//créer une instance (un objet) de la classe désirée fonctionnant sur plusieurs navigateurs
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');//un appel de fonction supplémentaire pour écraser l'en-tête envoyé par le serveur, juste au cas oùi il ne s'agit pas de text/xml, pour certaines versions de navigateurs Mozilla
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}

if (!http_request) {
alert('Abandon :( Impossible de créer une instance XMLHTTP');
return false;
}
http_request.onreadystatechange = function() { traitementReponse(http_request,id_ecrire); } //affectation fonction appelée qd on recevra la reponse
// lancement de la requete
http_request.open('POST', url, true);
//changer le type MIME de la requête pour envoyer des données avec la méthode POST , !!!! cette ligne doit etre absolument apres http_request.open('POST'....
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
obj=document.getElementById(id_niveau);
data="val_sel="+obj.value;
http_request.send(data);
}

function traitementReponse(http_request,id_ecrire) {
var affich="";
if (http_request.readyState == 4) {
if (http_request.status == 200) {
// cas avec reponse de PHP en mode texte:
//chargement des elements reçus dans la liste
var affich_list=http_request.responseText;
obj = document.getElementById(id_ecrire);
obj.innerHTML = affich_list;
}
else {
alert('Un problème est survenu avec la requête.');
}
}
}
</script>

</head>

<body>
		<div id="sf_menu1" class="sf_m">
				<h3><!--%nom_module%--></h3>
				<div id="information_erreur" class="false">
        		<ul id="message">
        			<!--%loop:messages%-->
        			<li><!--%message%--></li>
        			<!--%endLoop:messages%-->
        		</ul>
      		</div>
			</div>
			<div class="cleared"></div>
		<div class="corps1">
			<!--/***************************************/-->
                    <div class="imgleft2"></div>
					<div class="imgmiddle2">
				<div class="btn"><span class="btnleft"></span><span class="btnmiddle"><h5><!--%nom_fonction%--></h5></span><span class="btnright"></span></div>
				<div class="btn1"><span class="btnleft"></span><span class="btnmiddle"><h5><!--%nom_liste%--></h5></span><span class="btnright"></span></div>
				<div class="cleared"></div>
					<div class="formulaire">
					<!-- ======== formulaire concernant le contrat ======= -->
					<form method="post" action="<!--%edit_action%-->" name="form2">
						<div class="tab">
							<span class="ctr">N&#176; CONTRAT</span>
							<span class="ctr"><input name="ONN_numero_contrat" type="text" class="resizeall" id="ONN_numero_contrat"  value="<!--%num_contrat%-->" maxlength="20" /></span>
							
						</div>
					
					  <div id="sbright"><span class="btleft"></span></span><input type="submit" name="rechercher" id="rechercher" value="Rechercher" class="btmiddle"/><span class="btright"></span> </div>
					  <span class="ctr1 pr2">DATE D'ECHEANCE</span> 
							<span class="ctr"><input name="dateecheance" disabled="disabled" type="text" class="resizeall" id="dateecheance" value="<!--%date_ech%-->" maxlength="10"/>
							</span>
					  <div class="cleared lign"></div>
                    </form>
				
				<!-- ======== formulaire concernant offre - produit - formule ======= -->
				<form method="post" action="index.php" name="form1" id="form">
				<div class="content_tableform1">
				  <div>
					<span class="offr">OFFRE</span>
					<span class="offr">
					<div id="id_list1">
						<select class="select1" name="offre"  id="id_niv1"  onchange="makeRequest('rep_ajaxphp.php?id=<!--%id_contrat%-->&numcontrat=<!--%num_contrat%-->&d=<!--%date_ech%-->','id_niv1','id_list2')">
							<option value="-1">-- Choisissez --</option>
					  		<!--%loop:options_1%-->
					  			<option value="<!--%option_value_1%-->" <!--%if:isset($['selected_1'])%-->selected="selected"<!--%endIf%-->><!--%option_name_1%--></option>
					  		<!--%endLoop:options_1%-->
							
						</select> 
					</div> 
					</span>
					<div class="cleared"></div>
					<span class="pr">PRODUIT</span>
						<span class="pr"><div id='id_list2'>
							<select class="select1" name='produit' id='cont_list2'  onChange="makeRequest('rep_ajaxphp1.php','cont_list2','id_list3')" >
                          		<option value="0">-- Choisissez --</option>
								<!--%loop:options_2%-->
								<option value="<!--%option_value_2%-->" <!--%if:isset($['selected_2'])%-->selected="selected"<!--%endIf%-->><!--%option_name_2%--></option>
								<!--%endLoop:options_2%-->
							</select>
					<!-- ici sera charge la reponse mode texte de PHP à la request AJAX -->
						</div>
					</span>
					<span class="pr pr2">FORMULE</span>
						<span class="pr"><div id='id_list3'>
							<select class="select1" name='formule' id='cont_list3'  onChange="makeRequest('rep_ajaxphp2.php?id=<!--%id_contrat%-->&d=<!--%date_ech%-->&numcontrat=<!--%num_contrat%-->&id1="+document.getElementById('id_niv1').value+"&id2="+document.getElementById('cont_list2').value+"','cont_list3','id_list4')" > 
								<option value="0">-- Choisissez --</option>
								<!--%loop:options_3%-->
								<option value="<!--%option_value_3%-->" <!--%if:isset($['selected_3'])%-->selected="selected"<!--%endIf%-->><!--%option_name_3%--></option>
								<!--%endLoop:options_3%-->
							</select>
						</div>
					</span>
				  </div>
				  </div>
   
	  <div class="cleared"></div>
	  <div id="sbmiddle">
	  	<span class="btleft"></span>
	    <input type="submit" value="Valider" name="Valider1"   class="resizeall btmiddle"/>
	    <span class="btright"></span>
	  </div>
	  <div id="dv">
	  	<div class="dv1 sb">
				<div>
					<span class="btleft"></span>
					<input type="submit" value="Rechercher" name="Rechercher"  id="rechercher" class="resizeall btmiddle"/>
					<span class="btright"></span>
				</div>
		</div>
	</div>
	</form>
	 </div>	
 	</div>
	<div class="imgright2"></div>
    
   	<div class="bt1"><a href="<!--%url_annuler%-->"><span class="btleft"></span><span class="btmiddle">Annuler</span><span class="btright"></span></a></div>
	<div class="bt"><a href="<!--%url_retour%-->"><span class="btleft"></span><span class="btmiddle">Retour</span><span class="btright"></span></a></div>

	<div class="cleared"></div>
</div>
</body>
</html>